package com.fs.service.impl;


import com.fs.dao.ClassPaperDao;
import com.fs.pojo.ClassPaper;
import com.fs.service.ClassPaperService;
import com.fs.utils.BeanFactories;
import com.fs.utils.IdWorker;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * (TbClassPaper)表服务实现类
 *
 * @author makejava
 * @since 2022-11-15 10:21:15
 */

public class ClassPaperServiceImpl implements ClassPaperService {
   private ClassPaperDao classPaperDao = BeanFactories.getBean(ClassPaperDao.class);

    @Override
    public void addClassPaper(List<ClassPaper> classpapers) {
        for (int i = 0; i < classpapers.size(); i++) {
            SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            IdWorker id =  new IdWorker();
            classpapers.get(i).setId(""+id.nextId());
            classpapers.get(i).setPublishTime(sdf.format(new Date()));
            classPaperDao.insert(classpapers.get(i));
        }
    }
}
